module.exports = function(a,b){
    var c = false,changes = {};
    function _merge(a,b,changes){
        if(a && b && typeof a === 'object' && typeof b === 'object'){
            if(a instanceof Array && b instanceof Array){
                a.splice(0,a.length);
                for(var i = 0; i < b.length; i ++) a.push(b[i]);
            }else{
                for(var key in b){
                    if(a[key] && b[key] && typeof a[key] === 'object' && typeof b[key] === 'object') {
                        changes[key] = {};
                        _merge(a[key],b[key],changes[key]);
                    }else{
                        a[key] = b[key];
                        changes[key] = true;
                    }
                }
            }
        }else{
            console.err('typeof arguments must be object and not null',a,b);
        }
    }
    _merge(a,b,changes);
    return a;
}